<?php

namespace app\admin\model\merchant;

use think\Model;

class MerchantMoneyLog extends Model
{
    protected  $autoWriteTimestamp = 'datetime';

    protected $createTime = 'create_time';

    protected $updateTime = 'update_time';

    public function getTypeAttr($value)
    {


        $type=['del'=>'减少','add'=>'增加'];
        return $type[$value];
    }

    public static function log($data)
    {
        $add['money']=$data['money'];
        $add['type']=$data['case'];
        $add['merchant_id']=$data['id'];
        $add['balance']=$data['balance'];
        $add['operate_id']=$data['operate_id'];
        self::create($add);
        return true;
    }
}